import api from "../../api/index.js";
Page({
  data: {
    addressList: [],
    modelType:1//默认地址类型删除模式
  },
  onLoad(o) {
    if (o && o.modalType) {
      this.setData({
        modalType:o.modalType
      })
    }
    getApp().initLanguage(this)
    wx.setNavigationBarTitle({
      title: this.data.$t.ad_index.title,
    })
    api.addressList({data:{}})
    .then((res)=>{
      this.setData({
        addressList:res.data
      })
    })
  },
  onShow: function(o) {
    if (o && o.modalType) {
      this.setData({
        modalType:o.modalType
      })
    }
    // AUTH.checkHasLogined().then(isLogined => {
    //   if (isLogined) {
    //     this.initShippingAddress();
    //   } else {
    //     wx.showModal({
    //       confirmText: this.data.$t.common.confirm,
    //       cancelText: this.data.$t.common.cancel,
    //       content: this.data.$t.auth.needLogin,
    //       showCancel: false,
    //       success: () => {
    //         wx.navigateBack()
    //       }
    //     })
    //   }
    // })
  },
  onSelectedOk(parma){
    wx.setStorageSync("currentAddress",parma.detail.currentAddress)
    wx.navigateBack({
      delta: 1
    })
  }
})

